<template>
  <div
    class="listCard"
    :infinite-scroll-disabled="disabled"
    :infinite-scroll-immediate="false"
  >
    <div
      class="listCardItem"
      v-for="(item, index) in listCardData"
      :key="index"
    >
      <div class="images">
        <img
          :src="item.picUrl || item.coverImgUrl"
          @click="clickListCardItem(item.id)"
        />
      </div>
      <div class="title">
        {{ item.name || item[index].name }}
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "MyListCard",
  props: {
    listCardData: {
      type: Array,
      default() {
        return [];
      },
    },
  },
  data() {
    return {
      disabled: true,
    };
  },
  methods: {
    // 点击歌曲封面回调
    clickListCardItem(id) {
      this.$emit("clickListCardItem", id);
    },
  },
};
</script>

<style>
.listCard {
  display: flex;
  flex-wrap: wrap;
  margin: 10px 0;
  width: 100%;
}
.listCardItem {
  width: 16%;
  margin: 0 2% 20px 23px;
  overflow: hidden;
  cursor: pointer;
}
.images {
  width: 100%;
  height: 200px;
}
.images img {
  width: 100%;
  height: 100%;
  border-radius: 10%;
}
.images img[src=""],
img:not([src]) {
  width: 100%;
  height: 200px;
  background: url("../../assets/imgLoading.png") no-repeat center;
  background-size: 100% 100%;
}
.title {
  margin-top: 8px;
  font-size: 14px;
  color: black;
  line-height: 17px;
  /* 两行溢出 */
  text-overflow: -o-ellipsis-lastline;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}
</style>